#pragma warning disable 0618
using System;
using System.Collections.Generic;
using Table.DataModel;
namespace Table.Dao
{
    public class TableRaidRunMapBoxDao:DaoBase<TableRaidRunMapBox>
    {
        public override string GetFileName()
        {
            return "TableRaidRunMapBox.csv";
        }
        public override void BuildIndex()
        {
            if (cacheList != null)
            {
                cachePrimaryInt = new Dictionary<int, TableRaidRunMapBox>(cacheList.Count);
            }
            base.BuildIndex();
        }
        public override void AddOneIndex(TableRaidRunMapBox model)
        {
            if (!cacheOneIndex.ContainsKey(model.episodeId.ToString()))
            {
                cacheOneIndex[model.episodeId.ToString()] = new List<TableRaidRunMapBox>();
            }
            cacheOneIndex[model.episodeId.ToString()].Add(model);
        }
        public override void AddPrimaryIndex(TableRaidRunMapBox model)
        {
            #if UNITY_EDITOR
            if(cachePrimaryInt.ContainsKey(model.BoxId)) UnityEngine.Debug.LogError("数据表id重复:TableRaidRunMapBox->id: " + model.BoxId);
            #endif
            cachePrimaryInt[model.BoxId] = model;
        }
        protected override TableRaidRunMapBox ParseRowData(string[] rowData)
        {
            TableRaidRunMapBox data = new TableRaidRunMapBox();
            if (!string.IsNullOrEmpty(rowData[0]))
            {
                data.BoxId = int.Parse(rowData[0]);
            }
            if (!string.IsNullOrEmpty(rowData[1]))
            {
                data.episodeId = int.Parse(rowData[1]);
            }
            if (!string.IsNullOrEmpty(rowData[2]))
            {
                data.boxType = int.Parse(rowData[2]);
            }
            if (!string.IsNullOrEmpty(rowData[3]))
            {
                data.reward = string.Intern(rowData[3]);
            }
            if (!string.IsNullOrEmpty(rowData[4]))
            {
                data.BoxEffect0 = string.Intern(rowData[4]);
            }
            if (!string.IsNullOrEmpty(rowData[5]))
            {
                data.BoxEffect1 = string.Intern(rowData[5]);
            }
            if (!string.IsNullOrEmpty(rowData[6]))
            {
                data.BoxRes = string.Intern(rowData[6]);
            }
            return data;
        }
    }
}
